/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cl.zeke.cursos.jsf2spring3jpa2.util;

import java.io.OutputStream;
import org.dom4j.DocumentException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.xhtmlrenderer.pdf.ITextRenderer;

/**
 *
 * @author taller
 */
@Component
public class PdfUtil {
    
    private static Logger log = LoggerFactory.getLogger(PdfUtil.class);
   
    public void generarDesdeUrl(String url, OutputStream os) {
        try {
            ITextRenderer renderer = new ITextRenderer();
            System.out.println("url : "+url);
            renderer.setDocument(url);
            renderer.layout();
            renderer.createPDF(os);
            //firmarDocumento();
        } catch (Exception ex) {
            log.error("error", ex);
        }
    }
}
